
import pers.cz.queue.RequestQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: PostGirl-panent
 * @description: StartRUn
 * @author: Cheng Zhi
 * @create: 2021-03-13 17:23
 **/
@SpringBootTest
public class StartRun {

    Logger log = LoggerFactory.getLogger(StartRun.class);
    @Test
    public void test1() {

/*        StartRunTestCase run = new StartRunTestCase();
        List<Integer> list = new ArrayList<Integer>();
        list.add(61);
        list.add(62);*/

        //run.startRun(list);
    }

    @Test
    public void test2() {
        List<Integer> list = new ArrayList<>();
        list.add(61);
        list.add(62);
        RequestQueue.addQueue(list);

        System.out.println(RequestQueue.getQueueSize());
    }

    /**
     * 密码加密
     */
    @Test
    public void test3() {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
        String name = "cz";
        String age = "18";
        log.debug("name:{},age:{}",name,age);
        String password = "123456";
        String encode = bCryptPasswordEncoder.encode(password);
        System.out.println(encode);
        encode = "$2a$10$Q9LSUEJ8piG9c7on6/SBKexWqBWu9awQHVOrj9tmsMG4VPqVdDxrK";
        boolean matches = bCryptPasswordEncoder.matches(password, encode);
        System.out.println("两个密码一致:"+matches);

    }

    @Test
    public void test4() {

/*        TestCaseController controller = new TestCaseController();
        controller.testException();*/

    }

    @Test
    public void test5() {

        Map<String, String> map = new HashMap<>();
        List<Student> list = new ArrayList<Student>();
        for (int i=0; i<10; i++) {
            Student student = new Student();
            student.setAge(i);
            student.setName("cz" + i);
            student.setHome("nmg" + i);
            list.add(student);
        }

        list.forEach(student -> {
            System.out.println(student.getAge());
            map.put(student.getHome(),"home");
            map.put(student.getName(),"name");
        });

        System.out.println(map.get("nmg5"));

    }


}

class Student{

    private String name;
    private String home;
    private Integer age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHome() {
        return home;
    }

    public void setHome(String home) {
        this.home = home;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
